package com.ys.timer;

import com.ys.service.finance.TcwOperateCompanyPrepaymentService;
import com.ys.util.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;

import java.util.Date;

@Controller
public class TimerTcwOperateCompanyPrepaymentMonth {
	private static final Logger logger = LoggerFactory.getLogger(TimerTcwOperateCompanyPrepaymentMonth.class);

	@Autowired
	private TcwOperateCompanyPrepaymentService tcwOperateCompanyPrepaymentService;

	//每月00:00:01点执行，刷新上个月的运营公司预付款管理表信息
	//@Scheduled(cron = "1 0 0 1 * * ")
	public void addByOldMonth() {
		try {
			logger.info("***********定时刷新上个月的运营公司预付款管理表信息***********");
			String countMonth = DateUtil.getYYYY_MM(DateUtil.addMonth(new Date(),-1));
			String oldMonth = DateUtil.getYYYY_MM(DateUtil.addMonth(new Date(),-2));
			//tcwOperateCompanyPrepaymentService.addByOldMonth(countMonth,oldMonth);
			logger.info("***********定时刷新上个月的运营公司预付款管理表信息完成***********");
		}catch (Exception e){
			logger.error("定时刷新上个月的运营公司预付款管理表信息表出错：",e.getMessage(),e);
		}
	}



	
}
